<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改课程信息')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-course-edit" th:object="${course}">
            <input name="id" th:field="*{id}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label">课程名称：</label>
                <div class="col-sm-8">
                    <input name="name" th:field="*{name}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">               
                <label class="col-sm-3 control-label">课程介绍：</label>
                <div class="col-sm-8">
                    <textarea name="introduce" class="form-control" th:field="*{introduce}"></textarea>                    
                </div>                
            </div>
           <!--  <div class="form-group">
                <label class="col-sm-3 control-label">课程图片：</label>
                <div class="col-sm-8">
                    <textarea name="picture" class="form-control">[[*{picture}]]</textarea>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">课程分类编号：</label>
                <div class="col-sm-8">
                    <input name="typeId" th:field="*{typeId}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">课程分类名称：</label>
                <div class="col-sm-8">
                    <input name="typeName" th:field="*{typeName}" class="form-control" type="text">
                </div>
            </div> -->
            <div class="form-group">    
                <label class="col-sm-3 control-label">课程价格：</label>
                <div class="col-sm-8">
                    <input name="price" th:field="*{price}" class="form-control" type="text">
                </div>
            </div>            
            <div class="form-group">    
                <label class="col-sm-3 control-label">课程状态：</label>
                <div class="col-sm-8">
                    <select  class="form-control" name="status" th:with="type=${@dict.getType('wct_coursr_status')}">                       
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:selected="*{status}==${dict.dictValue}"></option>
                    </select>  
                </div>
            </div>            
            <div class="form-group">    
                <label class="col-sm-3 control-label">课程主讲老师：</label>
                <div class="col-sm-8">
                <input name="teacherName" id="teacherName" th:field="*{teacherName}" class="form-control" type="hidden">
                <select class="form-control m-b" name="teacherId" id="teacherId">                  
                   <option th:each="teacher : ${teachers}" th:text="${teacher.name}" th:value="${teacher.id}" th:selected="*{teacherId}==${teacher.id}" ></option>
                </select>    
                </div>
            </div>            
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script type="text/javascript">
        var prefix = ctx + "course/course";
        $("#form-course-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
            	/*$("#typeName").val($("#typeId").find("option:selected").text());*/
            	$("#teacherName").val($("#teacherId").find("option:selected").text());
                $.operate.save(prefix + "/edit", $('#form-course-edit').serialize());
            }
        }

        $("input[name='publishTime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
    </script>
</body>
</html>